.PHONY : clean echo

CC = gcc
RM = rm

vpath %.c demo \
	  iotgoAPI/src \
	  iotgoRuntime/cjson \
	  iotgoRuntime/src \
          iotgoRuntime/ssl/library \
          platformAPI/src
vpath %.h iotgoAPI/include \
          iotgoRuntime/cjson \
          iotgoRuntime/include \
          iotgoRuntime/ssl/include/polarssl \
	  platformAPI/include


EXE = exe

CFLAGS = -I ./iotgoAPI/include \
	 -I ./platformAPI/include \
	 -I ./iotgoRuntime/cjson \
	 -I ./iotgoRuntime/include \
	 -I ./iotgoRuntime/ssl/include/


SRCS = $(wildcard ./iotgoRuntime/src/*.c)
SRCS += $(wildcard ./iotgoAPI/src/*.c)
SRCS += $(wildcard ./iotgoRuntime/cjson/*.c)
SRCS += $(wildcard ./iotgoRuntime/ssl/library/*.c)
SRCS += $(wildcard ./platformAPI/src/*.c)
SRCS += $(wildcard ./demo/*.c)

OBJS = $(patsubst %.c, %.o, $(SRCS))


$(EXE) : $(OBJS)
	$(CC) -o $@ $^ -D_REENTRANT -lpthread -lm $(CFLAGS) 

%.o : %.c
	$(CC) -o $@ -c $^ $(CFLAGS)

clean :
	$(RM) -fr $(EXE) $(OBJS) *.gch

echo :
	@echo $(SRCS)
	@echo $(OBJS)
